# 1.导包
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service

class Driver(object):

    __driver = None

    @classmethod
    def get_driver(cls):
        # Chrome浏览器:
        path = r"D:\Programs\Python\Python313\chromedriver.exe"
        ser = Service(executable_path=path)
        if cls.__driver is None:
            cls.__driver = webdriver.Chrome(service=ser)
        return cls.__driver

    @classmethod
    def quit_driver(cls):
        cls.__driver.quit()

if __name__ == '__main__':
    Driver.get_driver()
    time.sleep(5)
    Driver.quit_driver()



